const mysql = require('mysql');
const pool = mysql.createPool({
    host:'rm-bp1d6ol9c4202ax651o.mysql.rds.aliyuncs.com',
    user:'v',
    password:'a123A',
    database:'youle-index',
    connectionLimit:10
})
module.exports = function(sql, value = []){
    return new  Promise((resolve, reject) => {
        pool.getConnection((err, connection) => {
            if(err) reject(err);
            connection.query(sql, value, (err, result) => {
                connection.release();
                if(err) reject(err)
                resolve(result);
            })
        })
    })
}